package lj.fx.tool.component;

import cn.hutool.core.util.RandomUtil;
import javafx.scene.paint.Color;
import javafx.scene.shape.Line;
import javafx.scene.shape.StrokeLineCap;

/**
 * 线条
 */
public class ComLine extends Line {

    public static ComLine randomShape() {
        ComLine line = new ComLine();
        line.setStartX(RandomUtil.randomInt(10, 100));
        line.setStartY(RandomUtil.randomInt(10, 100));
        line.setEndX(RandomUtil.randomInt(10, 100));
        line.setEndY(RandomUtil.randomInt(10, 100));

        line.setStroke(Color.RED);
        line.setStrokeWidth(10);
        line.setStrokeLineCap(StrokeLineCap.BUTT);

        line.getStrokeDashArray().addAll(15d, 5d, 15d, 15d, 20d);
        line.setStrokeDashOffset(10);


        return line;
    }
}
